R for public health: a short course on wrangling and visualizing data in R, including spatial data

Course materials: https://michaeldgarber.github.io/teach-r/

This short course introduced participants to popular tools in R for manipulating (“wrangling”) and visualizing data through public-health-focused examples. The course focused on tools that are a part of and that work well with the tidyverse. Packages covered include dplyr and sf for manipulating data, and ggplot2, mapview, and tmap for visualizing data.

Many examples transition back and forth between data with and without a spatial component, showing that working with and visualizing spatial data need not require separate specialized geographic information systems (GIS) software.

For example:

library(mapview)
library(here)
library(sf)
library(tidyverse)
setwd(here("data-processed"))
load("tract_ga_wrangle.RData")
tract_ga_wrangle %>% 
  dplyr::select(pop, county_fips, geometry) %>% 
  rename(Population=pop) %>% 
  mapview(zcol="Population",layer.name="Population")



Copyright © 2025 Michael D. Garber